#ifndef _TRIE_H_
#define _TRIE_H_

#define MAX_INDEX_LEN (256) //TRIE树的最大索引数
#define NODE_SIZE (1024)

typedef struct Trie_node Trie_node; //自定义的数据类型

struct Trie_node
{
	unsigned int ifend;
	Trie_node *branch[MAX_INDEX_LEN];
};

typedef struct Trie_queue Trie_queue;

struct Trie_queue
{
	unsigned int node_size;
	unsigned int node_total;
	unsigned int node_cursor;
	Trie_node *trie_root;
};

static Trie_queue *trie_queue = NULL;

void node_init(Trie_node *tr);
void queue_init();
int words_add(char *word);
int words_delete(char *word);
int words_filter(char *words, char *info);
Trie_node *words_search(char *words, int start, int end, Trie_node *tr);
int jump_byte_utf8(char *words, int pos);
Trie_node *word_search(char *words, int start, int end, Trie_node *tr);

#endif
